feat(events)!: cull stale annotated LLM histories#398
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughLLM start events now project annotated request history for non-fresh agents, while codec-backed execution preserves provider input and restores annotations if re-encoding fails. Scope freshness is tracked per owning agent, compaction events re-arm freshness, and CLI normalization recognizes PostCompact events. ChangesLLM annotation history and compaction
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant LlmCall
participant ScopeStack
participant RequestCodec
participant StartSubscriber
LlmCall->>ScopeStack: consume agent freshness
ScopeStack-->>LlmCall: fresh or stale state
LlmCall->>RequestCodec: re-encode projected annotation when stale
LlmCall->>StartSubscriber: emit sanitized LLM Start event
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 282-290: The history filter in
limit_json_history_to_current_user_turn is dropping OpenAI Responses instruction
items with role developer by only retaining system markers. Update the retention
predicate passed to retain_current_user_turn so it preserves both system and
developer roles alongside the current user turn, using the existing Json role
checks in this function.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 0025c458-0ef6-4506-8991-15d40437f679
📒 Files selected for processing (9)
crates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/tests/unit/observability/atof_tests.rsdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (28)
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
Spell
NVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.md
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring[NVIDIA/NeMo](link)over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/SKILL.md
📄 CodeRabbit inference engine (AGENTS.md)
SKILL.mdfiles are skill entrypoints and must start with YAML frontmatter containing at leastnameanddescription.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
⚙️ CodeRabbit configuration file
**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Update
README.md,fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.
**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such asRELEASING.md, not as user-facing docs pages orCHANGELOG.md
Keep stable user-facing wrappers atscripts/root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, andgrpc-v1protocol details on separate pagesIf links in documentation change, run
just docs-linkcheck.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mddocs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,markdown,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mddocs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mddocs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdcrates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile skills/ # Published Codex/agent skills for NeMo Relay usage patternsPrerequisites
Insta...
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mddocs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdcrates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
In MDX files, top-of-file comments must use JSX comment delimiters (
{/*to open and*/}to close); do not use HTML comments for MDX SPDX headers
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
{docs,examples}/**/*
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update docs and examples.
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
docs/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If documentation examples or commands under
docs/change, run the targeted docs checks appropriate to the change.
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions in Rust and Python: use
snake_case.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,py,js,mjs,cjs,ts,tsx}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,py,go,js,ts,c,h}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use language-appropriate naming conventions: Rust
snake_case, C FFI exports prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,go,js,ts}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding
//comment form.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If a language surface changed, always run that language's test target even when Rust core did not change.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement the new or changed public runtime behavior first in the Rust core, especially under
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, andcrates/core/src/json.rs.
Files:
crates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}
📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)
Do not add tests under
src; Rust tests belong in cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/core/src/api/llm.rs
🔇 Additional comments (9)
crates/core/tests/unit/llm_api_tests.rs (1)
14-25: LGTM!Also applies to: 48-208, 210-257
crates/core/tests/unit/observability/atof_tests.rs (1)
11-11: LGTM!Also applies to: 1257-1326
docs/about-nemo-relay/concepts/events.mdx (1)
83-91: LGTM!Also applies to: 106-107
docs/configure-plugins/observability/atof.mdx (1)
104-105: LGTM!docs/instrument-applications/instrument-llm-call.mdx (1)
241-245: LGTM!skills/nemo-relay-export-atif-trajectories/SKILL.md (1)
26-28: LGTM!skills/nemo-relay-export-openinference/SKILL.md (1)
32-33: LGTM!skills/nemo-relay-setup-observability/SKILL.md (1)
41-43: LGTM!crates/core/src/api/llm.rs (1)
293-345: 📐 Maintainability & Code QualityVerify the required Rust and core-runtime validation pass.
This touches
crates/core, so please confirmcargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings,just test-rust, and the full binding validation matrix required for core changes were run. As per coding guidelines, “Any Rust change must runjust test-rust,” “Any Rust change must runcargo fmt --all,” and “Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings.” As per path instructions, “Changes tocrates/coreorcrates/adaptivemust run the full language matrix.”Also applies to: 388-400, 473-475, 527-529, 574-603
Sources: Coding guidelines, Path instructions
815bc5e to
a36fd97
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/core/tests/unit/llm_api_tests.rs (1)
131-170: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winSnapshot the codec annotations too.
The current assertions only prove the raw request and response JSON stay untouched. They do not catch an in-place mutation of
annotated_requestorannotated_response, which is the boundary this test is meant to protect.🧪 Suggested check
+ let original_annotated_request = annotated_request.as_ref().clone();Repeat the same snapshot for the response annotation before wrapping it in
Arc.Also applies to: 284-285
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/core/tests/unit/llm_api_tests.rs` around lines 131 - 170, The test only snapshots the raw request/response and still misses in-place mutation of the codec annotations. In llm_api_tests around the llm_call / llm_call_end flow, add a snapshot for the response annotation before wrapping it in Arc, similar to original_request and original_response. Use the existing annotated_request and annotated_response symbols to verify both annotations remain unchanged across the call boundary.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@crates/core/tests/unit/llm_api_tests.rs`:
- Around line 131-170: The test only snapshots the raw request/response and
still misses in-place mutation of the codec annotations. In llm_api_tests around
the llm_call / llm_call_end flow, add a snapshot for the response annotation
before wrapping it in Arc, similar to original_request and original_response.
Use the existing annotated_request and annotated_response symbols to verify both
annotations remain unchanged across the call boundary.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 410d12ed-2321-47b5-854a-952f26aed438
📒 Files selected for processing (17)
crates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/runtime/state.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rscrates/core/tests/unit/observability/atof_tests.rsdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.md
📜 Review details
⏰ Context from checks skipped due to timeout. (20)
- GitHub Check: Node.js / Test (windows-amd64)
- GitHub Check: Node.js / Test (macos-arm64)
- GitHub Check: Node.js / Test (windows-arm64)
- GitHub Check: Python / Test (linux-arm64)
- GitHub Check: Node.js / Test (linux-arm64)
- GitHub Check: Go / Test (macos-arm64)
- GitHub Check: Python / Test (macos-arm64)
- GitHub Check: Node.js / Test (linux-amd64)
- GitHub Check: Python / Test (windows-arm64)
- GitHub Check: Go / Test (windows-arm64)
- GitHub Check: Python / Test (linux-amd64)
- GitHub Check: Go / Test (windows-amd64)
- GitHub Check: Rust / Test (linux-amd64)
- GitHub Check: Python / Test (windows-amd64)
- GitHub Check: Rust / Test (macos-arm64)
- GitHub Check: Rust / Test (linux-arm64)
- GitHub Check: Rust / Test (windows-arm64)
- GitHub Check: Go / Test (linux-amd64)
- GitHub Check: Go / Test (linux-arm64)
- GitHub Check: Rust / Test (windows-amd64)
🧰 Additional context used
📓 Path-based instructions (29)
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
Spell
NVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.md
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring[NVIDIA/NeMo](link)over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/SKILL.md
📄 CodeRabbit inference engine (AGENTS.md)
SKILL.mdfiles are skill entrypoints and must start with YAML frontmatter containing at leastnameanddescription.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
⚙️ CodeRabbit configuration file
**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Update
README.md,fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.
**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such asRELEASING.md, not as user-facing docs pages orCHANGELOG.md
Keep stable user-facing wrappers atscripts/root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, andgrpc-v1protocol details on separate pagesIf links in documentation change, run
just docs-linkcheck.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/codex.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdx
**/*.{md,markdown,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/codex.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdx
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdcrates/core/tests/unit/context_tests.rsdocs/nemo-relay-cli/codex.mdxdocs/instrument-applications/instrument-llm-call.mdxcrates/cli/tests/coverage/adapters_tests.rsdocs/nemo-relay-cli/basic-usage.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/configure-plugins/observability/atof.mdxcrates/core/src/api/runtime/state.rsdocs/nemo-relay-cli/claude-code.mdxcrates/cli/src/adapters/mod.rsdocs/about-nemo-relay/concepts/events.mdxcrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile skills/ # Published Codex/agent skills for NeMo Relay usage patternsPrerequisites
Insta...
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdcrates/core/tests/unit/context_tests.rsdocs/nemo-relay-cli/codex.mdxdocs/instrument-applications/instrument-llm-call.mdxcrates/cli/tests/coverage/adapters_tests.rsdocs/nemo-relay-cli/basic-usage.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/configure-plugins/observability/atof.mdxcrates/core/src/api/runtime/state.rsdocs/nemo-relay-cli/claude-code.mdxcrates/cli/src/adapters/mod.rsdocs/about-nemo-relay/concepts/events.mdxcrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/state.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/state.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/state.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions in Rust and Python: use
snake_case.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/state.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,py,js,mjs,cjs,ts,tsx}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/state.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use language-appropriate naming conventions: Rust
snake_case, C FFI exports prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/state.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding
//comment form.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/state.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/state.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If a language surface changed, always run that language's test target even when Rust core did not change.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/state.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/state.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/observability/atof_tests.rscrates/core/tests/unit/llm_api_tests.rs
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
In MDX files, top-of-file comments must use JSX comment delimiters (
{/*to open and*/}to close); do not use HTML comments for MDX SPDX headers
Files:
docs/nemo-relay-cli/codex.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdx
{docs,examples}/**/*
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update docs and examples.
Files:
docs/nemo-relay-cli/codex.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdx
docs/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If documentation examples or commands under
docs/change, run the targeted docs checks appropriate to the change.
Files:
docs/nemo-relay-cli/codex.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/nemo-relay-cli/codex.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdx
crates/core/src/api/runtime/state.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
crates/core/src/api/runtime/state.rs: Add registry fields asSortedRegistry<GuardrailEntry<T>>orSortedRegistry<Intercept<T>>toNemoRelayContextStateincrates/core/src/api/runtime/state.rs
Add chain execution helpers toNemoRelayContextStatefollowing the pattern of existing methods liketool_sanitize_request_chainortool_request_intercepts_chain
Files:
crates/core/src/api/runtime/state.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement the new or changed public runtime behavior first in the Rust core, especially under
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, andcrates/core/src/json.rs.
Files:
crates/core/src/api/runtime/state.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rs
{crates/**/src/**/*.rs,python/**/*.py}
📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)
Do not add tests under
src; Rust tests belong in cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/core/src/api/runtime/state.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
🔇 Additional comments (23)
crates/cli/src/adapters/mod.rs (1)
898-898: LGTM!crates/cli/tests/coverage/adapters_tests.rs (1)
933-933: LGTM!docs/nemo-relay-cli/basic-usage.mdx (1)
309-310: LGTM!docs/nemo-relay-cli/claude-code.mdx (1)
125-129: LGTM!docs/nemo-relay-cli/codex.mdx (1)
184-185: LGTM!crates/core/tests/unit/llm_api_tests.rs (3)
14-42: LGTM!
58-89: LGTM!
288-397: LGTM!Also applies to: 399-448, 451-611
crates/core/tests/unit/observability/atof_tests.rs (2)
12-45: LGTM!
1260-1347: LGTM!docs/about-nemo-relay/concepts/events.mdx (1)
83-96: LGTM!Also applies to: 111-113
docs/configure-plugins/observability/atof.mdx (1)
104-107: LGTM!docs/instrument-applications/instrument-llm-call.mdx (1)
241-246: LGTM!skills/nemo-relay-export-atif-trajectories/SKILL.md (1)
26-28: LGTM!skills/nemo-relay-export-openinference/SKILL.md (1)
32-34: LGTM!skills/nemo-relay-setup-observability/SKILL.md (1)
41-43: LGTM!crates/core/src/api/runtime/scope_stack.rs (2)
12-12: LGTM!Also applies to: 30-31, 45-49, 58-60, 144-144, 255-258
160-193: 🩺 Stability & AvailabilityCheck scope-stack affinity for
owning_agent_uuid().take_full_llm_context()/rearm_full_llm_context()assumeparent_uuidis resolved in the sameScopeStackinstance that owns the agent scope. Confirm that compactionMarkemission andemit_llm_start_with_subscribers()never cross a task/thread boundary; otherwise the fallback can consume or re-arm the wrong baseline.crates/core/src/api/runtime/state.rs (2)
29-29: LGTM!
194-199: 🗄️ Data Integrity & IntegrationCentralize the
compactionmark name
Thecompactionmark name should come from a shared constant used by both the runtime and the CLI adapter so the re-arm path can’t drift silently.crates/core/tests/unit/context_tests.rs (1)
98-136: LGTM!crates/core/src/api/llm.rs (2)
373-425: LGTM!Also applies to: 488-501, 541-552
265-351: 🎯 Functional CorrectnessInspect the current-turn truncation helpers directly. The summary points to
retain_current_user_turnand thelimit_*_to_current_user_turnpaths, but the implementation isn’t in the visible snippet. That logic decides whether prior-turn history is retained or dropped, so it needs a direct pass before relying on the change summary.
mnajafian-nv
left a comment
There was a problem hiding this comment.
I left four focused questions on contract consistency, concurrency, and compatibility. The post-sanitization projection direction looks sound; these comments are intended to make the breaking event contract consistent across every path before approval.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 307-320: retain_current_user_turn currently drops instruction
messages in the no-user branch by draining everything before the last item,
which can collapse a system/developer/assistant history down to only the
assistant turn. Update the no-user path in retain_current_user_turn so
instruction messages are preserved consistently with the user-found branch, and
make sure the helper still only trims non-instruction history when appropriate.
Add a regression test covering a user-less history containing system and
developer messages to verify those instructions remain after calling
retain_current_user_turn.
In `@crates/core/tests/unit/llm_api_tests.rs`:
- Around line 537-600: Add a baseline Start-event assertion in
custom_request_codecs_project_convertible_histories so the codec-driven
managed-execution path verifies both requests. Keep the existing delta check,
but also locate the custom-codec-baseline event in the collected events and
assert that its projected conversation preserves the full 4-message history and
the annotated request reflects all messages, matching the behavior already
covered in the other history tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 4edb5638-eebb-4a3b-84bc-ef2b5f596304
📒 Files selected for processing (10)
crates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/runtime/state.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/resolve.rscrates/core/tests/unit/llm_api_tests.rsdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdx
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: Check / Run
- GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (23)
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions in Rust and Python: use
snake_case.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,py,js,mjs,cjs,ts,tsx}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,py,go,js,ts,c,h}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use language-appropriate naming conventions: Rust
snake_case, C FFI exports prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,go,js,ts}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding
//comment form.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement the new or changed public runtime behavior first in the Rust core, especially under
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, andcrates/core/src/json.rs.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}
📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)
Do not add tests under
src; Rust tests belong in cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rs
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
crates/core/src/codec/openai_chat.rsdocs/instrument-applications/instrument-llm-call.mdxcrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rsdocs/about-nemo-relay/concepts/events.mdxcrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.{rs,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If a language surface changed, always run that language's test target even when Rust core did not change.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile skills/ # Published Codex/agent skills for NeMo Relay usage patternsPrerequisites
Insta...
Files:
crates/core/src/codec/openai_chat.rsdocs/instrument-applications/instrument-llm-call.mdxcrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rsdocs/about-nemo-relay/concepts/events.mdxcrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/src/codec/openai_chat.rscrates/core/src/codec/openai_responses.rscrates/core/src/codec/anthropic.rscrates/core/src/codec/resolve.rscrates/core/src/api/runtime/state.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/llm.rs
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
In MDX files, top-of-file comments must use JSX comment delimiters (
{/*to open and*/}to close); do not use HTML comments for MDX SPDX headers
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Update
README.md,fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.
**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such asRELEASING.md, not as user-facing docs pages orCHANGELOG.md
Keep stable user-facing wrappers atscripts/root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, andgrpc-v1protocol details on separate pagesIf links in documentation change, run
just docs-linkcheck.
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
**/*.{md,markdown,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
{docs,examples}/**/*
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update docs and examples.
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
docs/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If documentation examples or commands under
docs/change, run the targeted docs checks appropriate to the change.
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
crates/core/src/api/runtime/state.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
crates/core/src/api/runtime/state.rs: Add registry fields asSortedRegistry<GuardrailEntry<T>>orSortedRegistry<Intercept<T>>toNemoRelayContextStateincrates/core/src/api/runtime/state.rs
Add chain execution helpers toNemoRelayContextStatefollowing the pattern of existing methods liketool_sanitize_request_chainortool_request_intercepts_chain
Files:
crates/core/src/api/runtime/state.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
🔇 Additional comments (18)
docs/about-nemo-relay/concepts/events.mdx (1)
94-97: LGTM!Also applies to: 115-117
docs/instrument-applications/instrument-llm-call.mdx (1)
247-250: LGTM!crates/core/src/api/runtime/scope_stack.rs (1)
46-51: LGTM!Also applies to: 60-64, 148-149, 165-209, 271-278
crates/core/src/api/runtime/state.rs (2)
548-576: LGTM!
196-201: 🩺 Stability & AvailabilityConfirm compaction marks rearm the originating agent
Compaction marks should only callrearm_full_llm_context(event.parent_uuid())when the activecurrent_scope_stack()is guaranteed to contain that parent agent; otherwise the fallback can arm the wrong baseline for the next LLM call.crates/core/src/api/llm.rs (1)
486-506: LGTM!crates/core/src/codec/resolve.rs (1)
50-50: LGTM!Also applies to: 137-146
crates/core/src/codec/anthropic.rs (1)
58-58: LGTM!crates/core/src/codec/openai_chat.rs (1)
35-35: LGTM!crates/core/src/codec/openai_responses.rs (1)
50-50: LGTM!crates/core/tests/unit/llm_api_tests.rs (8)
8-38: LGTM!Also applies to: 50-61
78-154: LGTM!
ConversationCodecandHistoryResponseCodeccorrectly round-trip throughOpenAIChatCodecand populate theextracatch-all, matching the annotated request/response contract used elsewhere in the suite.
157-350: LGTM!Solid coverage: baseline-then-delta projection,
Arccopy-on-write isolation between the first (full-baseline) and second (reduced) Start events, and preservation ofmetadata/tools/content/output/usagefields in bounded events.
502-535: LGTM!Good coverage of no-op edge cases: empty history, opaque/non-matching message shapes, and scalar
input— all correctly assert no mutation.
615-666: LGTM!Manual, managed, and streaming end-path projections are exercised consistently, including annotated-response
extra.messagesreduction for the codec-backed cases.
712-807: LGTM!The emission-gate/mutex-holding design is correctly exploited here: the second thread can't reach its own sanitize-start guardrail until the first thread's entire
emit_llm_start_with_subscriberscall (including subscriber push) completes, which is exactly what's needed to prove reserved-baseline-before-delta ordering under concurrency.
490-500: 🎯 Functional CorrectnessConfirm the no-user fallback for assistant/tool turns. The current expectation drops the assistant message and keeps only the trailing tool result. If a no-user-boundary response is still meant to preserve tool context, this fallback should retain the assistant half of the pair or be documented explicitly.
667-710: 🗄️ Data Integrity & IntegrationCheck the failure-path end output projection. The
failed-history-endcase relies on.data(multi_turn_response()), butLlmCallExecuteParams::datais documented as handle-only state. Confirmemit_llm_end_without_outputis meant to project that payload intoend.output()on failure, and that this assertion cannot beNone.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 326-336: Update project_llm_request_to_current_user_turn to avoid
eagerly cloning AnnotatedLlmRequest via as_deref().cloned(). Use Arc::make_mut
on the existing Arc and apply
limit_annotated_request_history_to_current_user_turn in place, preserving the
Option/Arc structure and relying on copy-on-write only when the Arc is shared.
In `@crates/core/src/api/scope.rs`:
- Line 336: Replace the duplicated "compaction" event-name literals with a
shared constant, defining it in the appropriate common module and importing it
where needed. Update the comparison in the scope logic, normalization in the
adapters module, and related tests to reference this constant.
- Around line 331-338: In event(), avoid taking the scope stack write lock for
non-compaction events: use the existing read-only access path to collect
subscribers and reserve the write lock only when params.name == "compaction" so
mark_agent_fresh(parent_uuid) can mutate safely. Preserve
snapshot_event_subscribers behavior and ensure both branches produce the same
event/subscriber result.
In `@crates/core/tests/unit/llm_api_tests.rs`:
- Around line 357-409: Expand coverage around emit_llm_start_with_subscribers to
add a separate concurrent-start test that records dispatch order and asserts it
matches freshness reservation order, while retaining the existing exactly-once
[2, 4] assertion. Use the subscriber’s captured lifecycle events and
synchronization primitives to make the ordering check deterministic, and keep
concurrent_starts_consume_freshness_exactly_once_without_ordering focused only
on uniqueness.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 6e9458b2-bb22-4e9b-8cef-b474cebeefd2
📒 Files selected for processing (16)
crates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rsdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.md
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
- GitHub Check: Check / Run
- GitHub Check: CodeRabbit / Review
- GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (28)
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions in Rust and Python: use
snake_case.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,py,js,mjs,cjs,ts,tsx}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py,go,js,ts,c,h}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use language-appropriate naming conventions: Rust
snake_case, C FFI exports prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
**/*.{rs,go,js,ts}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding
//comment form.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
crates/cli/tests/coverage/adapters_tests.rsskills/nemo-relay-setup-observability/SKILL.mdcrates/core/tests/unit/context_tests.rsdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxcrates/cli/src/adapters/mod.rscrates/core/src/api/scope.rsdocs/configure-plugins/observability/atof.mdxcrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If a language surface changed, always run that language's test target even when Rust core did not change.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile skills/ # Published Codex/agent skills for NeMo Relay usage patternsPrerequisites
Insta...
Files:
crates/cli/tests/coverage/adapters_tests.rsskills/nemo-relay-setup-observability/SKILL.mdcrates/core/tests/unit/context_tests.rsdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxcrates/cli/src/adapters/mod.rscrates/core/src/api/scope.rsdocs/configure-plugins/observability/atof.mdxcrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
Spell
NVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.md
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring[NVIDIA/NeMo](link)over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/SKILL.md
📄 CodeRabbit inference engine (AGENTS.md)
SKILL.mdfiles are skill entrypoints and must start with YAML frontmatter containing at leastnameanddescription.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
⚙️ CodeRabbit configuration file
**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Update
README.md,fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.
**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such asRELEASING.md, not as user-facing docs pages orCHANGELOG.md
Keep stable user-facing wrappers atscripts/root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, andgrpc-v1protocol details on separate pagesIf links in documentation change, run
just docs-linkcheck.
Files:
skills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
**/*.{md,markdown,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.
Files:
skills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rscrates/core/src/api/runtime/scope_stack.rs
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
In MDX files, top-of-file comments must use JSX comment delimiters (
{/*to open and*/}to close); do not use HTML comments for MDX SPDX headers
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
{docs,examples}/**/*
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update docs and examples.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
docs/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If documentation examples or commands under
docs/change, run the targeted docs checks appropriate to the change.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdx
{crates/**/src/**/*.rs,python/**/*.py}
📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)
Do not add tests under
src; Rust tests belong in cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/cli/src/adapters/mod.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement the new or changed public runtime behavior first in the Rust core, especially under
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, andcrates/core/src/json.rs.
Files:
crates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
🔇 Additional comments (24)
crates/cli/src/adapters/mod.rs (1)
898-905: 📐 Maintainability & Code QualityRun the required Rust validation before handoff.
The
PostCompactclassification is correct. Because this is a Rust change, runjust test-rust,cargo fmt --all, andcargo clippy --workspace --all-targets -- -D warnings.As per coding guidelines, “Any Rust change must run
just test-rust,” “cargo fmt --all,” and “cargo clippy --workspace --all-targets -- -D warnings.”Source: Coding guidelines
crates/cli/tests/coverage/adapters_tests.rs (1)
929-934: LGTM!docs/nemo-relay-cli/basic-usage.mdx (1)
309-310: LGTM!docs/nemo-relay-cli/claude-code.mdx (1)
125-129: LGTM!docs/nemo-relay-cli/codex.mdx (1)
182-188: LGTM!crates/core/src/api/runtime/scope_stack.rs (2)
12-12: LGTM!Also applies to: 28-32, 40-51, 57-62, 132-158, 244-251
160-174: 🎯 Functional CorrectnessNo reachable stale-parent path here.
handle.parent_uuidis fixed when the LLM handle is created, andtake_agent_freshness()runs immediately against the captured stack during start emission. A missing lookup would only occur if a caller passed an unrelated or staleScopeHandleexplicitly, so this is defensive fallback behavior rather than a current bug.> Likely an incorrect or invalid review comment.crates/core/tests/unit/context_tests.rs (1)
98-136: LGTM!docs/configure-plugins/observability/atof.mdx (1)
102-106: LGTM!docs/instrument-applications/instrument-llm-call.mdx (1)
240-244: LGTM!skills/nemo-relay-export-atif-trajectories/SKILL.md (1)
25-28: LGTM!crates/core/src/api/llm.rs (6)
326-347: 🎯 Functional Correctness | ⚡ Quick winVerify Developer-role instructions survive the user-found branch.
is_instructiononly matchesMessage::System { .. }. In the user-found branch ofretain_current_request_turn,items.retain(is_instruction)drops every prefix item that isn't a match — so ifMessagehas a distinctDevelopervariant (OpenAI Responses supportsdeveloperalongsidesystem), developer instructions preceding the current turn are silently discarded. This mirrors a still-open prior review comment ("Could we split the no-user fallback by history kind here?... contradict the new start-event contract to preserve system/developer instructions") that has no recorded resolution, unlike the sibling no-user-branch fix.🔍 Verification script
#!/bin/bash set -euo pipefail rg -n "pub enum Message" -A 60 crates/types/src/codec/request.rs crates/core/src/codec/request.rs 2>/dev/null echo '---' rg -n "Developer" crates -g '*.rs'If
Message::Developerexists, update the predicate:🐛 Proposed fix
retain_current_request_turn( &mut annotated_request.messages, |message| matches!(message, Message::User { .. }), - |message| matches!(message, Message::System { .. }), + |message| matches!(message, Message::System { .. } | Message::Developer { .. }), )
391-407: 🩺 Stability & Availability | 🏗️ Heavy liftFreshness reservation is atomic; emission ordering after lock release is not.
take_agent_freshnessis consumed under a write lock, but the lock is released beforeproject_llm_request_to_current_user_turn, event construction, sanitization, and dispatcher enqueue run. Two threads sharing a propagated scope stack can still have the call that reserved the baseline enqueue after a call that was told it's stale, so a subscriber can observe the bounded event before the baseline. This is the same gap raised previously ("only the reservation is atomic... should baseline selection be coupled to an ordered emission sequence") and marked "Addressing," but the code here still shows the same release-then-emit shape. The newconcurrent_starts_consume_freshness_exactly_once_without_orderingtest (llm_api_tests.rs) only checks exactly-once consumption, not dispatch order, so it doesn't close this gap.
32-32: LGTM!
301-324: No-user fallback now preserves instructions correctly.
retain_current_request_turn's no-user branch now retainsindex == last_index || is_instruction(item), so a userless[system, system]history keeps both items instead of collapsing to the last one — this addresses the previously-flagged "no-user branch drains instructions" bug.
416-416: LGTM!
544-546: LGTM!docs/about-nemo-relay/concepts/events.mdx (1)
83-89: LGTM!Also applies to: 104-104
skills/nemo-relay-export-openinference/SKILL.md (1)
32-34: LGTM!skills/nemo-relay-setup-observability/SKILL.md (1)
41-43: LGTM!crates/core/tests/unit/llm_api_tests.rs (4)
72-130: LGTM!
132-179: LGTM!
182-272: LGTM!
274-355: LGTM!
9335871 to
cce72f3
Compare
mnajafian-nv
left a comment
There was a problem hiding this comment.
Great work, I love the simplification... Conditional approval upon reviewing inline suggestions
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 330-341: In the annotation projection logic of
emit_llm_start_with_subscribers, stop propagating codec.encode failures with ?.
Treat re-encoding as best-effort: only replace request and annotated_request
when encoding succeeds, and on failure preserve the original request and
annotation while allowing the LLM call to continue, matching the graceful
handling used by the sibling decode path.
In `@crates/core/tests/unit/llm_api_tests.rs`:
- Around line 185-283: Add error-path coverage to managed and streaming call
tests for a stale agent whose codec.encode fails inside
project_llm_request_to_current_user_turn. Introduce a test codec or failing
encode implementation using the existing LlmCodec interface, invoke both
llm_call_execute and llm_stream_call_execute, and assert the intended behavior
explicitly—currently propagated call failure, or graceful fallback if the
implementation is changed—while confirming fresh-agent behavior remains
unaffected.
In `@docs/configure-plugins/observability/atof.mdx`:
- Around line 102-106: The ATOF documentation incorrectly implies annotation
history retention is codec-dependent. Update the paragraph around “Codec-backed
LLM request inputs and annotations” to state that annotations are projected to
the current user turn whenever the owning agent is not fresh, while a configured
request codec additionally preserves the emitted event input’s complete history;
clarify that provider execution remains unchanged.
In `@docs/instrument-applications/instrument-llm-call.mdx`:
- Around line 240-244: The LLM start documentation incorrectly makes annotation
freshness projection appear dependent on a request codec. Update the description
around emit_llm_start_with_subscribers to state that inputs require a request
codec for current-turn projection, while annotations are projected to the
current user turn unconditionally; preserve the distinction between event inputs
and the provider execution request.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: ad963f91-9e12-4e6f-abd5-7f3585b33abe
📒 Files selected for processing (16)
crates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rsdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.md
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
- GitHub Check: CodeRabbit / Review
- GitHub Check: Check / Run
- GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (28)
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
In MDX files, top-of-file comments must use JSX comment delimiters (
{/*to open and*/}to close); do not use HTML comments for MDX SPDX headers
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdx
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Update
README.md,fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.
**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such asRELEASING.md, not as user-facing docs pages orCHANGELOG.md
Keep stable user-facing wrappers atscripts/root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, andgrpc-v1protocol details on separate pagesIf links in documentation change, run
just docs-linkcheck.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/about-nemo-relay/concepts/events.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdx
**/*.{md,markdown,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/about-nemo-relay/concepts/events.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdx
{docs,examples}/**/*
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update docs and examples.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdx
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdcrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rsdocs/about-nemo-relay/concepts/events.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxcrates/core/tests/unit/context_tests.rsdocs/configure-plugins/observability/atof.mdxcrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
docs/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If documentation examples or commands under
docs/change, run the targeted docs checks appropriate to the change.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdx
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile skills/ # Published Codex/agent skills for NeMo Relay usage patternsPrerequisites
Insta...
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdcrates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rsdocs/about-nemo-relay/concepts/events.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxcrates/core/tests/unit/context_tests.rsdocs/configure-plugins/observability/atof.mdxcrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/codex.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdx
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
Spell
NVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.md
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring[NVIDIA/NeMo](link)over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/SKILL.md
📄 CodeRabbit inference engine (AGENTS.md)
SKILL.mdfiles are skill entrypoints and must start with YAML frontmatter containing at leastnameanddescription.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
⚙️ CodeRabbit configuration file
**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.md
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions in Rust and Python: use
snake_case.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,py,js,mjs,cjs,ts,tsx}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use language-appropriate naming conventions: Rust
snake_case, C FFI exports prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding
//comment form.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If a language surface changed, always run that language's test target even when Rust core did not change.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/cli/src/adapters/mod.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}
📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)
Do not add tests under
src; Rust tests belong in cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/cli/src/adapters/mod.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/tests/unit/context_tests.rscrates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement the new or changed public runtime behavior first in the Rust core, especially under
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, andcrates/core/src/json.rs.
Files:
crates/core/src/api/scope.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
🔇 Additional comments (20)
crates/cli/src/adapters/mod.rs (1)
898-898: 📐 Maintainability & Code QualityConfirm the required Rust validation before merge.
Please verify
just test-rust,cargo fmt --all, andcargo clippy --workspace --all-targets -- -D warningspass for this Rust change.As per coding guidelines, “Any Rust change must run
just test-rust,”cargo fmt --all, andcargo clippy --workspace --all-targets -- -D warnings.Source: Coding guidelines
crates/cli/tests/coverage/adapters_tests.rs (1)
933-933: LGTM!docs/nemo-relay-cli/basic-usage.mdx (1)
309-310: LGTM!docs/nemo-relay-cli/claude-code.mdx (1)
125-129: LGTM!docs/nemo-relay-cli/codex.mdx (1)
184-185: LGTM!crates/core/src/api/scope.rs (2)
331-338: 🚀 Performance & Scalability | ⚡ Quick winWrite lock still taken unconditionally for non-compaction mark events.
scope_stack.write()is acquired for every call toevent(), butmark_agent_freshonly runs whenparams.name == "compaction". Non-compaction mark events now block concurrent readers unnecessarily on this hot path. This was flagged in a prior review round and remains unresolved.
336-336: 📐 Maintainability & Code Quality | 💤 Low value
"compaction"literal still duplicated across files.Same string is matched here, in
crates/cli/src/adapters/mod.rsnormalization, and in tests. A shared constant would prevent drift. Raised previously and still unresolved.crates/core/src/api/runtime/scope_stack.rs (2)
12-12: LGTM!Also applies to: 28-32, 40-51, 57-62, 132-158, 249-249
160-174: 🎯 Functional CorrectnessShared fallback is intentional.
parent_uuidis taken from the active scope stack and stored on the handle, soowning_agent_uuiddoes not encounter a stale parent in the current flow.> Likely an incorrect or invalid review comment.crates/core/tests/unit/context_tests.rs (1)
98-136: LGTM!skills/nemo-relay-export-atif-trajectories/SKILL.md (1)
26-29: LGTM!crates/core/src/api/llm.rs (4)
326-342: 🚀 Performance & ScalabilityUnconditional deep clone before checking if projection is a no-op.
Same code as previously flagged:
.cloned()always deep-clones the fullAnnotatedLlmRequest, and the clone is discarded whenlimit_annotated_request_history_to_current_user_turnreports no change (e.g. instructions-only history).Arc::make_mutavoids the clone unless theArcis actually shared.
406-417: 🩺 Stability & AvailabilityFreshness reservation is atomic; emission ordering is not.
Same unresolved concern as the earlier review thread: the write lock covers only
take_agent_freshness, and is released before projection, event construction, sanitization, and dispatcher enqueue happen. Two threads sharing a scope stack can reserve freshness in one order but dispatch start events in the opposite order, so a consumer cannot rely on "first dispatched start = baseline."
32-32: LGTM!Also applies to: 395-397, 426-426, 554-557
301-324: No-user instruction-retention fix looks correct.Instructions before the current turn are now preserved via the
is_instructionpredicate in both branches (previously only the last item survived when no user message existed). Verified againstrequest_projection_handles_history_edge_casesinllm_api_tests.rs(instructions-only and no-user cases both retain expected items).crates/core/tests/unit/llm_api_tests.rs (2)
368-420: 🩺 Stability & AvailabilityConfirms exactly-once freshness consumption but doesn't verify dispatch order.
Same gap as the earlier review thread: this proves reservation is mutually exclusive (
[2, 4]regardless of thread interleaving) but does not assert that event dispatch order matches reservation order — the residual concern flagged onemit_llm_start_with_subscribers.
8-29: LGTM!Freshness/compaction idempotency, projection edge cases, and nested-agent freshness isolation are all well covered with lifecycle-event-level assertions rather than shallow smoke checks.
Also applies to: 53-71, 72-130, 132-183, 285-366
docs/about-nemo-relay/concepts/events.mdx (1)
83-91: LGTM!Retention semantics (fresh-session full history, post-turn system+latest-user+trailing window, independent nested-agent freshness, codec-projected provider input, unchanged provider execution) match the implementation in
crates/core/src/api/llm.rsand are consistent with the parallel wording in both updatedSKILL.mdfiles.Also applies to: 106-106
skills/nemo-relay-export-openinference/SKILL.md (1)
32-35: LGTM!Consistent with
events.mdxand thellm.rsimplementation.skills/nemo-relay-setup-observability/SKILL.md (1)
41-44: LGTM!Consistent with
events.mdxand the OpenInference skill wording.
cce72f3 to
5879962
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 342-369: In project_llm_request_to_current_user_turn, do not
silently discard codec encoding failures: bind the error in the Err branch and
log a diagnostic via eprintln! before restoring original_annotation, matching
the existing logging approach in emit_optimization_marks_with while preserving
the graceful fallback behavior.
In `@docs/configure-plugins/observability/atof.mdx`:
- Around line 102-107: The ATOF documentation inaccurately describes stale LLM
request annotation history. Update the relevant wording near the ATOF event
description to state that stale annotations retain system instructions, the
latest user message, and all subsequent assistant/tool messages, matching the
terminology and behavior documented in the events concepts documentation.
In `@skills/nemo-relay-export-openinference/SKILL.md`:
- Around line 32-35: The stale-annotation documentation is incomplete: update
the relevant history-projection description in the skill documentation to state
that Relay retains system instructions, the latest user message, and all
subsequent assistant/tool messages, while preserving the fresh-session and
compaction behavior and provider-shaped input details.
In `@skills/nemo-relay-setup-observability/SKILL.md`:
- Around line 41-44: The stale-history description incorrectly says non-fresh
annotations retain only the current user turn. Update the relevant text in the
skill documentation to state that they retain system instructions, the latest
user message, and subsequent assistant/tool messages, matching the projection
semantics in events.mdx; keep the codec-backed event input wording consistent
and verify the documentation against the current API.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 636ac15a-3043-4d2a-af4f-aa28ce65a5d9
📒 Files selected for processing (16)
crates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rsdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (28)
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
Spell
NVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.md
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring[NVIDIA/NeMo](link)over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/SKILL.md
📄 CodeRabbit inference engine (AGENTS.md)
SKILL.mdfiles are skill entrypoints and must start with YAML frontmatter containing at leastnameanddescription.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
⚙️ CodeRabbit configuration file
**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.
Files:
skills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Update
README.md,fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.
**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such asRELEASING.md, not as user-facing docs pages orCHANGELOG.md
Keep stable user-facing wrappers atscripts/root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, andgrpc-v1protocol details on separate pagesIf links in documentation change, run
just docs-linkcheck.
Files:
skills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/about-nemo-relay/concepts/events.mdx
**/*.{md,markdown,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.
Files:
skills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/about-nemo-relay/concepts/events.mdx
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
skills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/codex.mdxcrates/cli/tests/coverage/adapters_tests.rsskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/about-nemo-relay/concepts/events.mdxcrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile skills/ # Published Codex/agent skills for NeMo Relay usage patternsPrerequisites
Insta...
Files:
skills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/codex.mdxcrates/cli/tests/coverage/adapters_tests.rsskills/nemo-relay-export-openinference/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/about-nemo-relay/concepts/events.mdxcrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
In MDX files, top-of-file comments must use JSX comment delimiters (
{/*to open and*/}to close); do not use HTML comments for MDX SPDX headers
Files:
docs/nemo-relay-cli/codex.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
{docs,examples}/**/*
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update docs and examples.
Files:
docs/nemo-relay-cli/codex.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
docs/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If documentation examples or commands under
docs/change, run the targeted docs checks appropriate to the change.
Files:
docs/nemo-relay-cli/codex.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/nemo-relay-cli/codex.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/about-nemo-relay/concepts/events.mdx
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions in Rust and Python: use
snake_case.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,py,js,mjs,cjs,ts,tsx}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use language-appropriate naming conventions: Rust
snake_case, C FFI exports prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding
//comment form.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If a language surface changed, always run that language's test target even when Rust core did not change.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement the new or changed public runtime behavior first in the Rust core, especially under
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, andcrates/core/src/json.rs.
Files:
crates/core/src/api/scope.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}
📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)
Do not add tests under
src; Rust tests belong in cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/core/src/api/scope.rscrates/core/src/api/runtime/scope_stack.rscrates/cli/src/adapters/mod.rscrates/core/src/api/llm.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
🔇 Additional comments (15)
crates/cli/src/adapters/mod.rs (1)
9-9: 📐 Maintainability & Code QualityConfirm the required Rust validation before merge.
The compaction mapping is consistent with the downstream
NormalizedEvent::Compactioncontract. Because this is a Rust change, confirm thatjust test-rust,cargo fmt --all, andcargo clippy --workspace --all-targets -- -D warningspass.As per path instructions, “Any Rust change must run
just test-rust,”cargo fmt --all, andcargo clippy --workspace --all-targets -- -D warnings.Also applies to: 899-907
Source: Path instructions
crates/cli/tests/coverage/adapters_tests.rs (1)
933-934: LGTM!docs/about-nemo-relay/concepts/events.mdx (1)
83-96: LGTM!Also applies to: 111-111
docs/instrument-applications/instrument-llm-call.mdx (1)
241-248: LGTM!docs/nemo-relay-cli/basic-usage.mdx (1)
309-310: LGTM!docs/nemo-relay-cli/claude-code.mdx (1)
125-129: LGTM!docs/nemo-relay-cli/codex.mdx (1)
184-185: LGTM!skills/nemo-relay-export-atif-trajectories/SKILL.md (1)
26-29: LGTM!crates/core/src/api/llm.rs (2)
433-444: 🩺 Stability & AvailabilityFreshness reservation is atomic; emission ordering is not.
take_agent_freshnessis consumed under the write lock, but the lock is released before projection, event construction, sanitization, and subscriber dispatch. Two concurrent starts on a shared/propagated stack can still reserve freshness in one order but dispatch events in the other, so "the first subscriber-visible start is the baseline" isn't actually guaranteed — only exclusive consumption is. This matches an unresolved concern from a prior review round without an explicit "addressed" confirmation.
32-32: LGTM!Also applies to: 301-341, 371-380, 422-424, 453-453, 581-584
crates/core/src/api/runtime/scope_stack.rs (2)
12-12: LGTM!Also applies to: 25-51, 60-64, 146-146, 178-189, 251-251
162-176: 🗄️ Data Integrity & IntegrationNo action needed here.
parent_uuidis derived from the active stack or an explicit parent handle, and the captured stack travels with the handle, so this fallback only affects invalid caller input.> Likely an incorrect or invalid review comment.crates/core/src/api/scope.rs (1)
22-24: LGTM!Also applies to: 334-345
crates/core/tests/unit/context_tests.rs (1)
98-137: LGTM!crates/core/tests/unit/llm_api_tests.rs (1)
8-30: LGTM!Also applies to: 54-627
5879962 to
8913295
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/core/src/api/scope.rs`:
- Around line 334-341: The compaction freshness transition and LLM-start event
enqueue are not serialized through a common ordering boundary. Update the
relevant scope event lifecycle functions, including the compaction handling
around `current_scope_stack` and `emit_llm_start_with_subscribers`, so each
agent’s freshness re-arm or consumption remains reserved until dispatcher
acceptance, preserving compaction-before-start and start-before-start ordering.
Add deterministic regressions in `crates/core` covering both ordering cases and
verify freshness is atomically consumed at LLM start without affecting scope
isolation.
In `@skills/nemo-relay-export-atif-trajectories/SKILL.md`:
- Around line 26-29: Update the documentation around request annotations in the
relevant skill guidance to precisely describe the stale projection: after the
initial/fresh session state is consumed, the annotation retains the current user
turn along with retained system instructions and subsequent assistant/tool
messages, rather than only the user turn. Verify the wording against the current
request codec and annotation API behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: a89fd4b0-03b5-4c8b-9537-6304af17ee06
📒 Files selected for processing (16)
crates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rsdocs/about-nemo-relay/concepts/events.mdxdocs/configure-plugins/observability/atof.mdxdocs/instrument-applications/instrument-llm-call.mdxdocs/nemo-relay-cli/basic-usage.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mdskills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (28)
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
In MDX files, top-of-file comments must use JSX comment delimiters (
{/*to open and*/}to close); do not use HTML comments for MDX SPDX headers
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/codex.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdx
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Update
README.md,fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.
**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such asRELEASING.md, not as user-facing docs pages orCHANGELOG.md
Keep stable user-facing wrappers atscripts/root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, andgrpc-v1protocol details on separate pagesIf links in documentation change, run
just docs-linkcheck.
Files:
docs/nemo-relay-cli/basic-usage.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/configure-plugins/observability/atof.mdxskills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdx
**/*.{md,markdown,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.
Files:
docs/nemo-relay-cli/basic-usage.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/configure-plugins/observability/atof.mdxskills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdx
{docs,examples}/**/*
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update docs and examples.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/codex.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdx
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
docs/nemo-relay-cli/basic-usage.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/configure-plugins/observability/atof.mdxskills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/nemo-relay-cli/claude-code.mdxcrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rsdocs/about-nemo-relay/concepts/events.mdxcrates/cli/tests/coverage/adapters_tests.rsdocs/instrument-applications/instrument-llm-call.mdxcrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
docs/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If documentation examples or commands under
docs/change, run the targeted docs checks appropriate to the change.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/codex.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdx
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile skills/ # Published Codex/agent skills for NeMo Relay usage patternsPrerequisites
Insta...
Files:
docs/nemo-relay-cli/basic-usage.mdxskills/nemo-relay-export-openinference/SKILL.mddocs/configure-plugins/observability/atof.mdxskills/nemo-relay-setup-observability/SKILL.mddocs/nemo-relay-cli/codex.mdxskills/nemo-relay-export-atif-trajectories/SKILL.mddocs/nemo-relay-cli/claude-code.mdxcrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rsdocs/about-nemo-relay/concepts/events.mdxcrates/cli/tests/coverage/adapters_tests.rsdocs/instrument-applications/instrument-llm-call.mdxcrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/nemo-relay-cli/basic-usage.mdxdocs/configure-plugins/observability/atof.mdxdocs/nemo-relay-cli/codex.mdxdocs/nemo-relay-cli/claude-code.mdxdocs/about-nemo-relay/concepts/events.mdxdocs/instrument-applications/instrument-llm-call.mdx
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
Spell
NVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.md
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring[NVIDIA/NeMo](link)over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/SKILL.md
📄 CodeRabbit inference engine (AGENTS.md)
SKILL.mdfiles are skill entrypoints and must start with YAML frontmatter containing at leastnameanddescription.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
⚙️ CodeRabbit configuration file
**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.
Files:
skills/nemo-relay-export-openinference/SKILL.mdskills/nemo-relay-setup-observability/SKILL.mdskills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions in Rust and Python: use
snake_case.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,py,js,mjs,cjs,ts,tsx}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use language-appropriate naming conventions: Rust
snake_case, C FFI exports prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding
//comment form.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement the new or changed public runtime behavior first in the Rust core, especially under
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, andcrates/core/src/json.rs.
Files:
crates/core/src/api/scope.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}
📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)
Do not add tests under
src; Rust tests belong in cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/core/src/api/scope.rscrates/cli/src/adapters/mod.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If a language surface changed, always run that language's test target even when Rust core did not change.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
🔇 Additional comments (17)
crates/cli/src/adapters/mod.rs (1)
9-9: LGTM!Also applies to: 899-907
crates/cli/tests/coverage/adapters_tests.rs (1)
933-934: LGTM!docs/about-nemo-relay/concepts/events.mdx (1)
83-96: LGTM!Also applies to: 111-111
docs/configure-plugins/observability/atof.mdx (1)
104-108: LGTM!skills/nemo-relay-export-openinference/SKILL.md (1)
32-36: LGTM!skills/nemo-relay-setup-observability/SKILL.md (1)
41-45: LGTM!docs/instrument-applications/instrument-llm-call.mdx (1)
241-248: LGTM!docs/nemo-relay-cli/basic-usage.mdx (1)
309-310: LGTM!docs/nemo-relay-cli/claude-code.mdx (1)
125-129: LGTM!docs/nemo-relay-cli/codex.mdx (1)
184-188: LGTM!crates/core/src/api/runtime/scope_stack.rs (3)
12-62: LGTM!Also applies to: 146-146, 251-251
162-176: 🗄️ Data Integrity & IntegrationDo Not Map an Unknown Parent to the Current Agent
When
parent_uuidis absent fromstack,map_or(self.stack.len(), ...)searches the entire stack and selects the topmost agent. A closed or foreign explicit parent can therefore consume or re-arm another agent’s freshness. Verify callers reject parents outside the captured stack; otherwise return an error instead of falling back.As per path instructions, pay close attention to scope propagation and
root_uuidisolation.Source: Path instructions
12-251: 📐 Maintainability & Code QualityRecord the Required Core-Runtime Validation
Confirm this change passes
cargo fmt --all, strict workspace Clippy,cargo deny check,just test-rust,validate-change, the Python, Go, and Node.js test targets, and the final all-files pre-commit pass.As per coding guidelines, Rust and core-runtime changes require these Rust checks and the full language matrix. As per path instructions, changes under
crates/corerequire broader validation.Sources: Coding guidelines, Path instructions
crates/core/src/api/scope.rs (1)
22-23: LGTM!Also applies to: 342-345
crates/core/tests/unit/context_tests.rs (1)
98-136: LGTM!crates/core/src/api/llm.rs (1)
32-32: LGTM!Also applies to: 301-383, 425-435, 456-456, 584-587
crates/core/tests/unit/llm_api_tests.rs (1)
8-626: LGTM!
Track freshness for the implicit root and nested agents, re-arm it on canonical compaction marks, and let non-agent scopes inherit their nearest agent state. Preserve complete request history for one fresh LLM start, then retain instructions and the latest user turn in both the annotation and codec-backed event input without changing provider execution. Keep event-only codec projection fail-open with diagnostics, normalize PostCompact, and cover managed, streaming, nested, concurrent, projection, and compaction behavior. Refs: RELAY-445 BREAKING CHANGE: LLM start request events may omit prior turns after the owning agent's freshness has been consumed. Signed-off-by: Will Killian <wkillian@nvidia.com>
8913295 to
dc9e1bc
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/core/src/api/runtime/scope_stack.rs`:
- Around line 162-176: Validate an explicit parent UUID in owning_agent_uuid
before calculating the search range: if parent_uuid is Some but not found in
self.stack, reject it rather than treating it as None or searching the full
stack. Preserve the existing agent lookup for valid parents and absent parents,
using the project’s established error or result-handling convention to report
the stale or foreign ScopeHandle.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 88491191-59f4-4e10-bd96-de0faa17f006
📒 Files selected for processing (7)
crates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/llm.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/tests/unit/llm_api_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
- GitHub Check: Check / Run
- GitHub Check: CodeRabbit
- GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (16)
**/*.rs
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
**/*.rs: Any Rust change must runjust test-rust
Any Rust change must runcargo fmt --all
Any Rust change must runcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allfor all FFI work since it is Rust work
Runjust test-rustto validate FFI changes
Runcargo clippy --workspace --all-targets -- -D warningsto enforce strict linting on FFI workWhen Rust files changed as part of Go work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings
**/*.rs: Runcargo fmt --allwhen Rust files are changed as part of Node work
Runcargo clippy --workspace --all-targets -- -D warningswhen Rust files are changed as part of Node work
Runjust test-rustwhen Rust files are changed as part of Node workWhen changing the core Rust runtime or Rust-facing API surface, format Rust code with
cargo fmt(rustfmt defaults), keepcargo clippy -- -D warningsclean, and satisfycargo deny checkperdeny.toml.
**/*.rs: If any Rust code changed, always runjust test-rust.
If any Rust code changed, also runcargo fmt --all.
If any Rust code changed, also runcargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, runcargo fmt --allandcargo clippy --workspace --all-targets -- -D warningseven if relying on pre-commit.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs
📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
If the change touched
crates/coreor shared runtime semantics, also usevalidate-changefor broader validation
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}
📄 CodeRabbit inference engine (AGENTS.md)
Follow binding naming conventions in Rust and Python: use
snake_case.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{rs,py,js,mjs,cjs,ts,tsx}: UseJson = serde_json::Valuein Rust-facing runtime APIs where the existing code expects JSON payloads.
UseResult<T>withFlowErrorin core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use language-appropriate naming conventions: Rust
snake_case, C FFI exports prefixednemo_relay_, GoPascalCase, Node.jscamelCase, and Pythonsnake_case.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding
//comment form.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}
📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Implement the new or changed public runtime behavior first in the Rust core, especially under
crates/core/src/api/and related core modules such ascrates/core/src/api/runtime/,crates/core/src/codec/, andcrates/core/src/json.rs.
Files:
crates/core/src/api/scope.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}
📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)
Do not add tests under
src; Rust tests belong in cratetests/trees, and Python SDK tests belong underpython/tests.
Files:
crates/core/src/api/scope.rscrates/cli/src/adapters/mod.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rs
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If a language surface changed, always run that language's test target even when Rust core did not change.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
**
⚙️ CodeRabbit configuration file
**:AGENTS.md
This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.
Project Overview
NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.
The shared runtime model is:
- Scope stacks decide where work belongs and which scope-local behavior is visible.
- Middleware registries decide what guardrails and intercepts run around managed calls.
- Plugins install reusable runtime behavior from configuration.
- Events record runtime behavior in ATOF form.
- Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.
Repository Structure
The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.crates/ core/ # Rust core runtime crate, published as nemo-relay adaptive/ # Adaptive runtime primitives and plugin components python/ # PyO3 native extension for the Python package ffi/ # Raw C ABI layer used by downstream bindings such as Go node/ # NAPI Node.js binding and JavaScript/TypeScript entry points python/ nemo_relay/ # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers tests/ # Python tests go/ nemo_relay/ # Experimental Go CGo binding and tests fern/ # Fern documentation site scripts/ # Stable wrappers and helper scripts; build/test/docs entry points live in justfile skills/ # Published Codex/agent skills for NeMo Relay usage patternsPrerequisites
Insta...
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/cli/src/adapters/mod.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs
⚙️ CodeRabbit configuration file
crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.
Files:
crates/core/src/api/scope.rscrates/core/tests/unit/context_tests.rscrates/core/src/api/runtime/scope_stack.rscrates/core/src/api/llm.rscrates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}
⚙️ CodeRabbit configuration file
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.
Files:
crates/core/tests/unit/context_tests.rscrates/cli/tests/coverage/adapters_tests.rscrates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs
📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)
Wire the new middleware chain into the execute path in
crates/core/src/api/tool.rsorcrates/core/src/api/llm.rsat the appropriate pipeline stage
Files:
crates/core/src/api/llm.rs
🔇 Additional comments (9)
crates/cli/src/adapters/mod.rs (2)
9-9: LGTM!Also applies to: 899-901
899-901: 📐 Maintainability & Code QualityRun the required Rust validation before merge.
Please confirm
just test-rust,cargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings, anduv run pre-commit run --all-filespass. As per coding guidelines and path instructions, these checks are required for Rust changes.Sources: Coding guidelines, Path instructions
crates/cli/tests/coverage/adapters_tests.rs (1)
933-934: LGTM!crates/core/src/api/runtime/scope_stack.rs (1)
12-12: LGTM!Also applies to: 25-33, 47-51, 60-62, 146-146, 251-251
crates/core/src/api/scope.rs (1)
22-23: LGTM!Also applies to: 334-345
crates/core/src/api/llm.rs (2)
32-32: LGTM!Also applies to: 301-340, 384-403, 425-460, 584-587
342-382: 🎯 Functional CorrectnessNo developer role exists in
Message—crates/types/src/codec/request.rsonly definesSystem,User,Assistant, andTool, so this typed projection cannot drop a separatedeveloperinstruction role.> Likely an incorrect or invalid review comment.crates/core/tests/unit/llm_api_tests.rs (1)
8-30: LGTM!Also applies to: 54-104, 105-163, 165-230, 232-330, 332-434, 436-517, 519-572, 574-626
crates/core/tests/unit/context_tests.rs (1)
98-136: LGTM!
|
/merge |
Overview
Warning
BREAKING CHANGE (Behavioral): LLM start request event inputs and annotations can omit earlier turns after the owning agent's freshness has been consumed. The request used for provider execution remains unchanged.
Implement RELAY-445 with per-agent freshness. A new agent session, and the first LLM start after compaction, retains the complete sanitized request history. Later starts cull the annotation and codec-backed event input to the current user turn.
Details
compactionevents. Repeated marks are idempotent, and bothPreCompactandPostCompactnormalize to the shared canonical event name.LlmRequestsoevent.inputandcategory_profile.annotated_requestcontain the same bounded history. If that event-only encode fails, emit a diagnostic, preserve the complete event input and annotation, and continue the provider call.Validation:
cargo fmt --alljust test-rust— 833 core unit tests plus integration tests passedcargo clippy --workspace --all-targets -- -D warningsjust test-python— 511 passedjust test-node— 254 passedjust test-gouv run pre-commit run --all-filesWhere should the reviewer start?
Start with
crates/core/src/api/runtime/scope_stack.rsfor the root/nested-agent freshness ownership,crates/core/src/api/llm.rsfor fail-open event-only request projection, andcrates/core/tests/unit/llm_api_tests.rsfor the behavioral contract.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)